home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / 3dvect39 / land.asm < prev    next >
Encoding:
Assembly Source File  |  1994-10-30  |  3.3 KB  |  131 lines

  1. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  2. ;
  3. ;        Filename     : land.asm
  4. ;        Included from: Main Assembley Module
  5. ;        Description  : Draw _background Horizon
  6. ;
  7. ;        Written by: John McCarthy
  8. ;                    1316 Redwood Lane
  9. ;                    Pickering, Ontario.
  10. ;                    Canada, Earth, Milky Way (for those out-of-towners)
  11. ;                    L1X 1C5
  12. ;
  13. ;        Internet/Usenet:  BRIAN.MCCARTHY@CANREM.COM
  14. ;                Fidonet:  Brian McCarthy 1:229/15
  15. ;          RIME/Relaynet: ->CRS
  16. ;
  17. ;        Home phone, (905) 831-1944, don't call at 2 am eh!
  18. ;
  19. ; Send me your protected mode source code!
  20. ; Send me your Objects!
  21. ; But most of all, Send me a postcard!!!!
  22. ;
  23. ; Simple non-rotatable background landscape.  Cannot be used with z rotations
  24. ; that is - it only draws a flat backgound landscape.  Use this  in  place of
  25. ; _clearfill routine.  This routine wipes all video memory within the current
  26. ; clipping parameters and puts the "landscape" in the background.
  27. ;
  28. ; NOTE: This routine sets the flag useclear=no and therefore  shuts  off  the
  29. ;       _clearfill routine in poly.inc.  This is done since  screen  clearing
  30. ;       is done at the same time as drawing the background landscape.
  31. ;
  32. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  33.  
  34.          .386p
  35.          jumps
  36.  
  37. code32   segment para public use32
  38.          assume cs:code32, ds:code32
  39.  
  40.          include pmode.ext                  ; protected mode externals by TRAN
  41.          include 3d.ext
  42.          include xmode.ext
  43.          include macros.inc
  44.          include equ.inc
  45.  
  46.          public _land_draw
  47.          public _land_ground
  48.          public _land_sky
  49.  
  50. ; horizon:
  51. ;    y = -yratio*sin(_eyeax)
  52.  
  53. _land_sky    db 0
  54. _land_ground db 22
  55.  
  56. _land_draw:
  57.          out_8 sc_data, all_planes          ; write to all planes
  58.  
  59.          mov ebp,100000
  60.  
  61.          mov eax,_esinx
  62.          neg eax
  63.          imul ebp
  64.          shrd eax,edx,14
  65.          mov ecx,eax
  66.  
  67.          mov eax,_ecosx
  68.          imul ebp
  69.          shrd eax,edx,14
  70.          mov ebp,eax
  71.  
  72.          cmp ebp,2500
  73.          jg do_a
  74.          mov ebp,2500
  75. do_a:
  76.          call _make3dy
  77.  
  78.          mov si,cx
  79.          add si,_ymins
  80.  
  81.          movzx edi,_cliptp
  82.          mov edi,_fastimultable[edi*4]
  83.          movzx ecx,_cliplt
  84.          shr ecx,2
  85.          add edi,ecx
  86.          add edi,_current_page
  87.  
  88.          mov dx,_ymaxs                      ; dx = counter
  89.          sub dx,_ymins
  90.          movzx edx,dx
  91.  
  92.          movzx ecx,_xmaxs
  93.          sub cx,_xmins
  94.          mov ebx,xactual
  95.          sub bx,cx
  96.          shr ebx,2
  97.          shr cx,3                           ; /4/2
  98.          mov ebp,ecx
  99.          mov ah,_land_sky                   ; background sky colour
  100.          mov al,_land_sky
  101.  
  102. plot_loop1:
  103.          cmp si,0                           ; check for horizon
  104.          jge here_s_johnny
  105.          mov ecx,ebp
  106. pl_1x:
  107.          rep stosw
  108.          add edi,ebx
  109.          inc esi
  110.          dec edx
  111.          jnz plot_loop1
  112.  
  113.          ret
  114.  
  115. here_s_johnny:
  116.          mov ah,_land_ground
  117.          mov al,_land_ground
  118.  
  119. plot_loop2:
  120.          mov ecx,ebp
  121. pl_2x:
  122.          rep stosw
  123.          add edi,ebx
  124.          dec edx
  125.          jnz plot_loop2
  126.  
  127.          ret
  128.  
  129. code32   ends
  130.          end
  131.